<?php
class service_uri{
	public function getCategoryUri($cateID){
		$cateDao = new DaoCategory();
		$cate = $cateDao->getOne("id='$cateID'");
		$url="";
		if(!empty($cate)){
			if($cate['typeID']==service_type::PRODUCT){
				$url = url('product/list?cateID='.$cate['id']);
			}elseif($cate['typeID']==service_type::NEWS){
				$url = url('news/index?cateID='.$cate['id']);
			}
		}
		return $url;
	}
	public function getAlbumUri($albumID){
		$albumDao = new DaoAlbum();
		$album = $albumDao->getOne("id='$albumID'");
		$url="";
		if(!empty($album)){
			$url = url('album/index?albumID='.$album['id']);
		}else{
			$url = url('album/index');
		}
		return $url;
	}
	public function getCategory2Uri($cateID){
		$cateDao = new DaoCategory();
		$cate = $cateDao->getOne("id='$cateID'");
		$url="";
		if(!empty($cate)){
			if($cate['typeID']==service_type::PRODUCT){
				$url = url('newp/list?cateID='.$cate['id']);
			}elseif($cate['typeID']==service_type::NEWS){
				$url = url('news/index?cateID='.$cate['id']);
			}
		}
		return $url;
	}
	public function getPageUri($pageID){
		$pageDao = new DaoPage();
		$page = $pageDao->getOne("id='$pageID'");
		$url = "";
		if(!empty($page)){
			$url = url('page/index?id='.$pageID);
		}
		return $url;
	}
	public function getProductUri($productID){
		$productDao = new DaoProduct();
		$p = $productDao->getOne("id='$productID'");
		$url = "";
		if(!empty($p)){
			$url = url('product/detail?id='.$p['id']);
		}
		return $url;
	}
	public function getNewsUri($newsID){
		$newsDao = new DaoNews();
		$news = $newsDao->getOne("id='$newsID'");
		$url = "";
		if(!empty($news)){
			$url = url('news/detail?id='.$news['id']);
		}
		return $url;
	}
	public function getVideoUri($videoID){
		$dao = new DaoVideo();
		$video = $dao->getOne("id='$videoID'");
		$url = "";
		if(!empty($video)){
			$url = url('video/detail?id='.$video['id']);
		}
		return $url;
	}

}
?>
